package com.xsmart.common.entity;

import com.baomidou.mybatisplus.plugins.Page;

import java.util.HashMap;
import java.util.Map;

public class ResponseBean {
    /**
     * 请求结果编码，对应结果编码字典
     */
    private int result = 0;
    /**
     * 请求结果描述
     */
    private String message;
    /**
     * 请求来源，取值PC/MOBILE/WX
     */
    private String source;
    /**
     * 请求服务名称
     */
    private String serviceName;
    /**
     * 请求方法名称
     */
    private String methodName;
    /**
     * 登录验证，该值从登录接口获取
     */
    private String token;
    private Map<String, Object> privates;
    private Map<String, Object> resultData = new HashMap<>();

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Map<String, Object> getPrivates() {
        return privates;
    }

    public void setPrivates(Map<String, Object> privates) {
        this.privates = privates;
    }

    public Map<String, Object> getResultData() {
        return resultData;
    }

    public void setResultData(Map<String, Object> resultData) {
        this.resultData = resultData;
    }

    public void addResultItem(String name, Object value) {
        resultData.put(name, value);
    }

    public void addResultPageItem(String name, Page page) {
        EcomPage ecomPage = new EcomPage(page);
        resultData.put(name, ecomPage);
    }
}
